package ar.edu.unq.wannaplay.panels.client;

import ar.edu.unq.wannaplay.exceptions.BlankStringException;
import ar.edu.unq.wannaplay.exceptions.EmailSyntaxException;
import ar.edu.unq.wannaplay.pages.client.ClientsViewPage;
import ar.edu.unq.wannaplay.panels.FeedBackPanel;
import ar.edu.unq.wannaplay.services.ClientService;
import ar.edu.unq.wannaplay.utils.ClientEditer;

public class NewClientPanel extends EditClientPanel {
    private static final long serialVersionUID = 1L;

    public NewClientPanel(final String id, final ClientEditer modelObject, final ClientService service,
            final FeedBackPanel feedBackPanel) {
        super(id, modelObject, service, feedBackPanel);
    }

    @Override
    protected void errorWrapedAction(final ClientEditer bind) throws BlankStringException, EmailSyntaxException {
        this.getService().saveClient(bind.getName(), bind.getEmail(), bind.getAddress(), bind.getTown());
        this.setResponsePage(ClientsViewPage.class);
    }

}
